package com.vanke.devops.domain.enums;

import com.vanke.core.exception.VankeBusinessException;

/**
 * @author 陈景阳
 * @since 2018/6/8
 */
public enum ScheduleJobErrorCode implements ErrorCode {
    JOB_EXEC_ERROR("0001","执行定时任务失败"),
    FETCH_CRON_TRIGGER("0002","获取定时任务CronTrigger出现异常"),
    CREATE_JOB_ERROR("0003","创建定时任务失败"),
    UPDATE_JOB_ERROR("0004","更新定时任务失败"),
    EXEC_JOB_ERROR("0005","立即执行定时任务失败"),
    STOP_JOB_ERROR("0006","暂停定时任务失败"),
    DEL_JOB_ERROR("0007","删除定时任务失败")
    ;
    private String code;
    private String message;

    ScheduleJobErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public VankeBusinessException getException(){
        return new VankeBusinessException(this.getCode(), this.getMessage());
    }

    @Override
    public String getCode() {
        return ErrorCode.getErrorCodePrefix(ScheduleJobErrorCode.class) + code;
    }
    @Override
    public String getMessage() {
        return message;
    }
}
